package oop.day03.HomeWork;
public class PolymorphicDemo
{
    public static void main(String[] args)
    {
        Animal[] animals = new Animal[5];
        animals[0] = new Dog("dd",1,"red");
        animals[1] = new Fish("hh",2,"gold");
        animals[2] = new Fish("aa",2,"black");
        animals[3] = new Chick("ga ga",1,"yellow"   );
        animals[4] = new Chick("ge ge",2,"gray");
        for (int i = 0; i < animals.length; i++)
        {
            System.out.println(" animals [" + i + "] = " + animals[i].name);
            animals[i].eat();
            animals[i].drink();
            if(animals[i] instanceof Dog)
            {
                Dog dog = (Dog) animals[i];
                dog.lookHome();
            }

            if(animals[i] instanceof Chick)
            {
                Chick chick = (Chick)animals[i];
                chick.layEggs();
            }

            if(animals[i] instanceof Swim)
            {
                Swim swim = (Swim)animals[i];
                swim.swim();
            }


        }

        Master master = new Master();
        Dog dog = new Dog("Big Yellow",2,"yellow");
        Chick chick = new Chick("Ge Ge ", 2,"gray");
        Fish fish = new Fish("F vv", 3,"gold");
        master.feed(dog);
        master.feed(chick);
        master.feed(fish);
    }
}
